/**
 * @description  : 行政区划选择
 * @descriptionDetail : 行政区划选择
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-10-03 17:10:18
 */
<template>
  <view style="width: 100%;">
    <u-input
      :border="false"
      type="select"
      :placeholder="$attrs.placeholder || '请选择'"
      v-model="value"
      v-bind="$attrs"
      @click="areaSelectShow = !readOnly"
      :select-open="areaSelectShow"
    ></u-input>
    <u-popup mode="bottom" height="60%" v-model="areaSelectShow">
      <area-select :root="root" @choose="selectArea"></area-select>
    </u-popup>
  </view>
</template>
<script>
import AreaSelect from "./area-select.vue"
export default {
  components: {AreaSelect},
  props: {
    value: {
      type: String | Number,
      default: ''
    },
    dictType: {     // 字典类型
      type: String,
      default: ""
    },
    root: {
      type: String | Number,
      default: ""
    },
    readOnly: { // 只读
     type: Boolean,
      default: false
    }
  },
  data() {
    return {
      border: false,
      areaSelectShow: false,
      dictList: [],
      areaList: [],
    }
  },
  watch: {
    
  },
  created () {
  },
  methods: {
    selectArea(args) {
      let arg = args[0];
      this.$emit("confirm", {
        name: [arg.proName,arg.admdivName,arg.countryName].join(","),
        value: [arg.proCode,arg.admdivCode,arg.countryCode].join(",")
      });
      this.areaSelectShow = false;
    }
  },
}
</script>